<html>
<head><meta charset="utf-8"><title>How to have the #[cfg(not(test))] code active? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20have.20the.20.23.5Bcfg(not(test)).5D.20code.20active.3F.html">How to have the #[cfg(not(test))] code active?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217863647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20have%20the%20%23%5Bcfg%28not%28test%29%29%5D%20code%20active%3F/near/217863647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Geobomatic <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20have.20the.20.23.5Bcfg(not(test)).5D.20code.20active.3F.html#217863647">(Nov 25 2020 at 09:51)</a>:</h4>
<p>Hi, the code marked as <code>#[cfg(not(test))]</code> is grayed out, and the <code>#[cfg(test)]</code> is normally rendered. How to achieve the opposite? I tried to uncheck the <code>--all-targets</code> option, with no luck <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span></p>



<a name="218312263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/How%20to%20have%20the%20%23%5Bcfg%28not%28test%29%29%5D%20code%20active%3F/near/218312263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Paul Faria <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/How.20to.20have.20the.20.23.5Bcfg(not(test)).5D.20code.20active.3F.html#218312263">(Nov 30 2020 at 16:47)</a>:</h4>
<p>Currently this isn't exposed as configurable yet. I've been working on this on and off and unfortunately haven't been able to put much time into it these past couple of weeks. I'll ramp up again this week</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>